/*
Disclaimer of Warranty: THE PACKAGE IS PROVIDED
BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS'
AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF
THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(c) Copyright 2013 Edward Principe
All Rights Reserved

*/
#ifndef PARSENODE_H
#define PARSENODE_H

#include <string>
#include "tokerr.h"

using namespace std;

/////////////////////////////////////////////////////////////////
// ParseNode: A structure used by parse all; representing a
//            word parsed
////////////////////////////////////////////////////////////////
struct ParseNode
{
public: // Construction
	ParseNode()
	{
		Init();
	}

	ParseNode(const ParseNode& rhs)
	{
		Init();
		Copy(rhs);
	}

public: // Attribute
	wstring word; // A word parsed
	bool is_begin; // The beginning
	bool is_end; // The end
	bool is_string; // Is it a string?
	TokErr err; // Error returned

private: // Methods
	void Init()
	{
		is_begin = is_end = is_string = false;
		err = TERR_NONE;
	}

	void Copy(const ParseNode& rhs)
	{
		if (this == &rhs)
			return;

		word = rhs.word;
		is_begin = rhs.is_begin;
		is_end = rhs.is_end;
		is_string = rhs.is_string;
		err = rhs.err;
	}

public: // Operators
	ParseNode& operator = (const ParseNode& rhs)
	{
		Copy(rhs);
		return *this;
	}
};
#endif